package com.qsd.StudentSystem.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.qsd.StudentSystem.interceptor.UserInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer {

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("").setViewName("index");
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new UserInterceptor())
				.addPathPatterns("/**")
				.excludePathPatterns(
						"/login.html", 
						"/register.html", 
						"/student/login",
						"/student/register",
						"/bg.jpg"
						);
	}
	
	
	
}
